From: Keir Fraser Date: Thu, 6 May 2010 10:16:37 +0000 (+0100) Subject: EPT: fix handling of super page level limit X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12244 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=bceb7a68736d655ccb71563d890edecebec887f5;p=xen.git EPT: fix handling of super page level limit Just like for other global VMX controls, the maximum super page level used must be globally consistent (and not change post-init). Additionally, the original patch yet again introduced a message printed on each CPU, which this patch moves to a place where it gets issued just once. Signed-off-by: Jan Beulich --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index c3bfaa9d25..598ca15633 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -91,6 +91,10 @@ static void __init vmx_display_features(void) if ( !printed ) printk(" - none\n"); + + if ( vmx_ept_super_page_level_limit ) + printk("EPT supports %s super page.\n", + vmx_ept_super_page_level_limit > 1 ? "1G" : "2M"); } static u32 adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, u32 msr) @@ -114,6 +118,7 @@ static void vmx_init_vmcs_config(void) u32 _vmx_pin_based_exec_control; u32 _vmx_cpu_based_exec_control; u32 _vmx_secondary_exec_control = 0; + u8 ept_super_page_level_limit = 0; u32 _vmx_vmexit_control; u32 _vmx_vmentry_control; @@ -189,15 +194,9 @@ static void vmx_init_vmcs_config(void) uint64_t cap; rdmsrl(MSR_IA32_VMX_EPT_VPID_CAP, cap); if ( cap & VMX_EPT_SUPER_PAGE_1G ) - { - vmx_ept_super_page_level_limit = 2; - printk("EPT support 1G super page.\n"); - } + ept_super_page_level_limit = 2; else if ( cap & VMX_EPT_SUPER_PAGE_2M ) - { - vmx_ept_super_page_level_limit = 1; - printk("EPT support 2M super page.\n"); - } + ept_super_page_level_limit = 1; } } @@ -235,6 +234,7 @@ static void vmx_init_vmcs_config(void) vmx_pin_based_exec_control = _vmx_pin_based_exec_control; vmx_cpu_based_exec_control = _vmx_cpu_based_exec_control; vmx_secondary_exec_control = _vmx_secondary_exec_control; + vmx_ept_super_page_level_limit = ept_super_page_level_limit; vmx_vmexit_control = _vmx_vmexit_control; vmx_vmentry_control = _vmx_vmentry_control; cpu_has_vmx_ins_outs_instr_info = !!(vmx_basic_msr_high & (1U<<22)); @@ -247,6 +247,7 @@ static void vmx_init_vmcs_config(void) BUG_ON(vmx_pin_based_exec_control != _vmx_pin_based_exec_control); BUG_ON(vmx_cpu_based_exec_control != _vmx_cpu_based_exec_control); BUG_ON(vmx_secondary_exec_control != _vmx_secondary_exec_control); + BUG_ON(vmx_ept_super_page_level_limit > ept_super_page_level_limit); BUG_ON(vmx_vmexit_control != _vmx_vmexit_control); BUG_ON(vmx_vmentry_control != _vmx_vmentry_control); BUG_ON(cpu_has_vmx_ins_outs_instr_info !=